package com.swd.order.util;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.util.StringUtils;

import java.io.IOException;


public class descriptionSplite extends JsonSerializer {
    @Override
    public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {


        if (StringUtils.isEmpty(o)){
            jsonGenerator.writeNull();
        }else {
            String s = (String) o;
            String[] tagArrays = s.split(" ");
            jsonGenerator.writeArray(tagArrays,0,tagArrays.length);
        }
    }
}
